<%--
  Created by IntelliJ IDEA.
  User: Hasee
  Date: 2019/11/25
  Time: 15:11
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>合同查看</title>
    <style type="text/css">
        #div1 {
            color: gainsboro;
            font-size: 30px;
            text-align: center;
        }

        .div1 {
            width: 100%;
            height: 70px;
            position: relative;
        }

        .div1 img {
            border-radius: 50%;
        }

        .div1 span {
            font-size: 25px;
            position: absolute;
            top: 22px;
            color: white;
        }

        .div1 b {
            position: absolute;
            font-size: 25px;
            top: 30px;
            right: 20px;
            color: white;
        }

        .div2 {
            height: 40px;
            width: 240px;
            border-radius: 30px;
            margin-left: 100px;
            float: left;
            background-color: #99ccff;
        }

        .div2:first-child {
            background-color: #ffffff;
        }

        .div2 span {
            font-weight: bold;
            margin: 0px auto;
            width: 100%;
            text-align: center;
            display: inline-block;
            line-height: 40px;
            font-size: 20px;
        }

        input[type=text], select {
            position: absolute;
            top: -5px;
            right: 1px;
            width: 200px;
            height: 30px;
        }

        .top {
            width: 800px;
            margin: 0px auto;
        }

        #input1 {
            border: 1px solid black;
            height: 30px;
            width: 200px;
            border-radius: 30px;
            background-color: #99ccff;
            font-size: 20px;
            font-weight: bold;
        }


        #div2 {
            margin-left: 40%;
            width: 800px;
        }
    </style>
    <script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
    <script type="text/javascript">
        window.onload = function () {
            var lavel = document.cookie.split(";")[1].split("=")[1];
            console.log(document.cookie)
            $("#bb").html(lavel)
            clearAllCookie()
        }

        function clearAllCookie() {
            var keys = document.cookie.match(/[^ =;]+(?=\=)/g);
            if (keys) {
                for (var i = keys.length; i--;)
                    document.cookie = keys[i] + '=0;expires=' + new Date(0).toUTCString();
            }
        }

    </script>
</head>


<body style="background: url('images/22.jpg'); background-size: 100%;">
<!--startprint1-->
<div class="top">
    <div id="div1">-贷款详情-</div>
    <div class="div1">
        <img src="images/img/1.jpg" height="70px" width="100px"/>
        <span>产品名称：</span>
        <b>农村快贷</b>
    </div>

    <hr/>
    <div class="div1">
        <img src="images/img/1.jpg" height="70px" width="100px"/>
        <span>授信期限(月)：</span>
        <b>36</b>
    </div>
    <hr/>
    <div class="div1">
        <img src="images/img/1.jpg" height="70px" width="100px"/>
        <span>授信利率(%)：</span>
        <b>9.00</b>
    </div>
    <hr/>
    <div class="div1">
        <img src="images/img/1.jpg" height="70px" width="100px"/>
        <span>预授信额度(元)：</span>
        <b>100000</b>
    </div>
    <hr/>
    <div class="div1">
        <img src="images/img/1.jpg" height="70px" width="100px"/>
        <span>银行卡号：</span>
        <b id="b1">
            1
        </b>
    </div>
    <hr/>
    <div class="div1">
        <img src="images/img/1.jpg" height="70px" width="100px"/>
        <span>还款方式：</span>
        <b id="b2">
            1
        </b>
    </div>
    <!--endprint1-->
    <hr/>
    <br/>
    <br/>
    <br/>
    <div id="div2">
        <input type='button' id="input1" name='button_export' title='打印1' onclick=preview(1) value='打印合同'>
        <%--<a onclick="history.go(-1)" style="color: white" id="a1">关闭</a>
--%>
        <%--<input type="button" id="but" value="关闭" onclick="history.go(-1)">--%>
       <%-- <input type="button" id="but1" value="返回" onclick="fan()">--%>
    </div>
</div>
</body>

<script type="text/javascript">
    function lo(){
        self.location = "loan.jsp";
    }

    function fan() {
        self.location = "ClientMain.jsp";
    }

    function preview(fang) {
        if (fang < 10) {
            bdhtml = window.document.body.innerHTML; //获取当前页的html代码
            sprnstr = "<!--startprint" + fang + "-->"; //设置打印开始区域
            eprnstr = "<!--endprint" + fang + "-->"; //设置打印结束区域
            prnhtml = bdhtml.substring(bdhtml.indexOf(sprnstr) + 18); //从开始代码向后取html
            prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr)); //从结束代码向前取html
            window.document.body.innerHTML = prnhtml;
            window.print();
            window.document.body.innerHTML = bdhtml;
        } else {
            window.print();
        }
    }

    $(function () {

        $("#b1").val("");
        $("#b2").val("");

        var yinhangkahao = getCookie("kahao");
        var huankuanfangshi = getCookie("fangshi");
        var fangshi;
        if (huankuanfangshi == 1) {
            fangshi = "等额本息";
        } else if (huankuanfangshi == 2) {
            fangshi = "等额本金";
        }

        $("#b1").html(yinhangkahao);
        $("#b2").html(fangshi);
    })

    //通过Cookie获取所要修改产品的id
    var getCookie = function (name) {
        var arr;
        var reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
        if (arr = document.cookie.match(reg)) {
            return arr[2];
        } else
            return null;
    };

</script>
</html>
